cmake_minimum_required(VERSION 3.16)

project(workfinal VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 REQUIRED COMPONENTS Quick Widgets)

qt_standard_project_setup(REQUIRES 6.5)

# 设置QML文件
set(QML_FILES
    Main.qml
    CircularGauge.qml
    VerticalGauge.qml
    DetailView.qml
)

# 设置图像资源文件
set(IMAGE_FILES
    images/发动机灯.svg
    images/燃油灯.svg
    images/安全带灯.svg
    images/远光灯.svg
    images/制动警告.svg
    images/水温.svg
)

qt_add_executable(appworkfinal
    main.cpp
    CarDataModel.h
    CarDataModel.cpp
    ${QML_FILES}
)

# 创建QML资源文件
qt_add_resources(appworkfinal "qml_resources"
    PREFIX "/"
    FILES ${QML_FILES}
)

# 创建图像资源文件
qt_add_resources(appworkfinal "image_resources"
    PREFIX "/"
    FILES ${IMAGE_FILES}
)

qt_add_qml_module(appworkfinal
    URI workfinal
    VERSION 1.0
    NO_RESOURCE_TARGET_PATH
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appworkfinal PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appworkfinal
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appworkfinal
    PRIVATE Qt6::Quick Qt6::Widgets
)

include(GNUInstallDirs)
install(TARGETS appworkfinal
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
